package com.suanfa.util;


import com.suanfa.bintree.BinNodes;

public class ArrayUtils {

    public static  void printArray(int[] arr){
        for(int i : arr){
            System.out.print(i + ",");
        }
    }

    public static void swap(int[] arr, int left, int right){
        if(left< arr.length && right < arr.length){
            int temp = arr[left];
            arr[left] = arr[right];
            arr[right] = temp;
        }
    }

    public static void printNodeF(BinNodes head){
        if(head == null){
            System.out.println("null,");
            return;
        }
        System.out.print(head.getValue()+",");
        if(head.getLeft()!=null){
            System.out.print(head.getLeft().getValue()+",");
        }
        if(head.getRight() != null){
            System.out.print(head.getRight().getValue()+",");
        }
        printNodeF(head.getLeft());
        printNodeF(head.getRight());

    }
}
